<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
		<link rel="stylesheet" type="text/css" href="css/login.css"/>
	</head>
	<body>
	
	<!-- 使用cookies登录 -->

	
	
	
		<!--//最外的篮板-->
		<div id="container">
			<span id="xx" class="fontformat">
				登陆
			</span>
			<div id="close" class="pictrue">
				
			</div>
			
			<!--//里面的白ban-->
			<div id="inContainer">
				
				<!--//用户名-->
				<div id="inputBox"  class="inputr">
					<span class="f">用户名：</span>
					<!--//小图标-->
					<div class="pictrue f" id="pt01"></div>
					<input type="text" class="f" id="username" value="15766472116" placeholder="邮箱帐号或手机号" />
					<!--后台校验结果图标-->
					<div id="jg1" class="jg f" >
						<img src="img/ok.png" class="ok"/>
						<img src="img/no.png" class="on"/>
					</div>
					<span id="msglogin"></span>
				</div>
				
				<!--//密码-->
				<div id="inputBox2" class="inputr" >
					<span class="f">密码：</span>
					
					<!--//小图标-->
					<div class="pictrue f" id="pt02"></div>
					<input type="password" class="f" id="password" value="123" placeholder="密码" />
					<!--后台校验结果图标-->
					<div id="jg1" class="jg f" >
						<img src="img/ok.png" class="ok"/>
						<img src="img/no.png" class="on"/>
					</div>
				</div>
				
				<!--//验证码-->
				<div id="inputBox3"  class="inputr">
					<span class="f">验证码：</span>
				<!--	//小图标-->
					<div class="pictrue f" id="pt03"></div>
					<input type="text" class="f" id="tps" value="" maxlength="4" placeholder="验证码" />
					<!--验证码图片位置-->
					<div id="ptsecurity" class="f">
					  <img  src="${pageContext.request.contextPath}/user.do?method=security">
					</div>
					<!--后台校验结果图标-->
					<div id="jg9" class="jg f" >
						<img src="img/ok.png" class="ok" />
						<img src="img/no.png" class="on" id="tjg"/>
					</div>
					<span id="yzmcw"></span>
				</div>
				
				<!--//手机验证-->
				<!-- <div id="inputBox4"  class="inputr " >
					<span class="f">手机验证：</span>
					//小图标
					<div class="pictrue f" id="pt04"></div>
					
					<input type="text" class="f" id="phone" value="1234" placeholder="手机号码" />
					<input type="button" class="f" id="security" value="发送验证" />
					
					后台校验结果图标
					<div id="jg1" class="jg f" >
						<img src="img/ok.png" class="ok"/>
						<img src="img/no.png" class="on"/>
					</div>
				</div> -->
				
				<!--//十天内免登录-->
				<div id="unlogin" class="mdl">
					<div id="checkboxId">
					<input type="checkbox" name="passLogin" />
					</div>
					<span id="" >十天内免登录	</span>
				</div>
				
				<!--//忘记密码-->
				<div id="forgetpwd" class="mdl">
					<a href="#" class="mdl">忘记密码？</a>
				</div>
				
				
				<!--//登  录-->
				<div class="btn" id="btn01">
					<span id="login">
						登 陆
					</span>
				</div>
				
				<!--//去注册-->
				<div  class="btn" id="btn02">
					<span id="reg">
						去注册
					</span>
				</div>
			</div>
			
		</div>
		<span id="mm"></span>
		
		<!-- 使用cookies登录 -->
		
		
	</body>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.4.4.js" ></script>
	<script type="text/javascript">
	
	/* http://localhost:8090/liuhao/login/login.jsp */

	$('#ptsecurity').click(function(){
		window.location.href="login.jsp";
	});
	
	
	
	
	/* 去注册 */
		$('#btn02').click(function(){
			window.location.href="reg.jsp";
		});
		
	
	
		/* //登陆按钮 */
		$('#btn01').click(function(){
			
			var username= $('#username').val();
			var pass= $('#password').val();
			var tps= $('#tps').val();
			
			var url="${pageContext.request.contextPath}/user.do?method=loginUser";
			$.ajax({
				  'type': "post",
				  'url': url,
				  'dataType': "json",
				  'data':{
					  'lhName':username,
					  'lhPassword':pass,
					  'tps':tps,
				  },
				  success: function(msg){
					  
				 	 console.log(msg);
				 	 if(200==msg.code){
						  /* window.onload.href="login.html"; */
				 			window.location.href="${pageContext.request.contextPath}/manage/index.jsp";
						  
					  }else if(777==msg.code){
						  $('#yzmcw').html("错误");
						  $('#tjg').attr("class","null");
						  
					  }else{
						  $('#mm').html("登陆失败");
					  }
					 
					  
					   }
				});
		});
		
		$('#username').blur(function(){
			var u= $('#username').val();
			var reg=/^\d{11}$/
			if(reg.test(u)){
				$('#msglogin').html("");
			}else{
				$('#msglogin').html("必须是11数字");
			}
		});
		
	</script>
	
</html>